package inabit.inabitcompiler.parser;

import inabit.data.expression.arithmetic.ArithmeticExpression;

import java.util.HashMap;
import java.util.Map;

/**@author Rafael Rocha*/
public class ArithmeticExpressionMap {
	private static int number = 0;
	private static ArithmeticExpressionMap instance;
	private Map<String, ArithmeticExpression> expressionMap;
	
	
	private ArithmeticExpressionMap() {
		expressionMap = new HashMap<String, ArithmeticExpression>();
	}
	
	public static ArithmeticExpressionMap getInstance() {
		if(instance == null) {
			instance = new ArithmeticExpressionMap();
		}
		return instance;
	}
	public ArithmeticExpression getExpression(String id) {
		return expressionMap.get(id);
	}
	public String addExpression(ArithmeticExpression expression) {
		String key = "Exp#" + number++;
		this.expressionMap.put(key, expression);
		return key;
	}
}
